/**
 * 套件的模型定义
 */

import { getDefaultFields } from "../utils";



/**
 * 套件
 * @param app 
 */
export default (app) => {
  const DataTypes = app.Sequelize;


  const Model = app.model.define('template_def', {
    id: {
      type: DataTypes.INTEGER(8).UNSIGNED,
      allowNull: false,
      primaryKey: true,
      autoIncrement: true
    },
    templateId: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      comment: '模板Id'
    },

    status: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValueL: 'draft',
      comment: '状态'
    },
    ...getDefaultFields()
  }, {
    tableName: 'app_template',
    timestamps: false
  });

  Model.sync({ alter: true });
  return Model;
}
